public class TestMain {

    public static void main(String[] args) {

        ListNode listNode = new ListNode(1,null);

        listNode.next = new ListNode(2,null);

        Solution solution = new Solution();
        printListNode(solution.reverseList(listNode));
    }

    public static void printListNode(ListNode linkedList){
        ListNode head = linkedList;
        while (head != null){
            System.out.print(head.val + " ");
            head = head.next;
        }
        System.out.println();
    }


}
